import request from "@/utils/request";
const baseURL = "/score";

export const getScoreByCourseId = ({ courseId, semesterId, teacherId }) =>
  request({
    url: `${baseURL}/hasScore`,
    method: "GET",
    params: { courseId, semesterId, teacherId },
  });

export const queryScores = (data) =>
  request({
    url: `${baseURL}/list`,
    method: "POST",
    data,
  });

// 获取班级课程成绩统计数据
export const getClassCourseStats = (data) =>
  request({
    url: `${baseURL}/stats`,
    method: "POST",
    data,
  });

// 获取老师教授班级的成绩
export const getStudentScoresByTeacher = (query) =>
  request({
    url: `${baseURL}/currentTeacher`,
    method: "POST",
    data: query,
  });

export const saveOrUpdateScore = (params) =>
  request({
    url: `${baseURL}/saveOrUpdate`,
    method: "POST",
    data: params,
  });

// 获取学生个人成绩
export const getStudentScores = (data) =>
  request({
    url: `${baseURL}/student`,
    method: "POST",
    data,
  });

// 导出成绩数据
export const exportScores = (data) =>
  request({
    url: `${baseURL}/export`,
    method: "POST",
    data,
    responseType: "blob",
  });
